package com.guomao.democ;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;

public class JavaDemo {

    public static void main(String[] args) throws Exception {

        Class<?> clazz = Class.forName("com.guomao.democ.Person");

        Class<MyAnnotationA> maac = MyAnnotationA.class;


        MyAnnotationA a = clazz.getDeclaredAnnotation(maac);

        System.out.println(a.num());
        System.out.println(Arrays.toString(a.values()));
        System.out.println(a.value());

        Method sleep = clazz.getDeclaredMethod("sleep");

        MyAnnotationA a1 = sleep.getDeclaredAnnotation(maac);
        System.out.println(a1.num());
        System.out.println(Arrays.toString(a1.values()));
        System.out.println(a1.value());


        Field name = clazz.getDeclaredField("name");
        MyAnnotationA a2 = name.getDeclaredAnnotation(maac);
        System.out.println(a2.num());

//        Constructor<?> noargs = clazz.getDeclaredConstructor();
//        Constructor<?> haveargs = clazz.getDeclaredConstructor(String.class);

    }

}
